package models

import "gorm.io/gorm"

type Task struct {
	gorm.Model
	TaskNumber string `gorm:"comment:'任务编号'" json:"task_number"`
	TaskName   string `gorm:"type:varchar(20);not null; comment:'任务名'" json:"task_name"`
	Module     string `gorm:"type:varchar(20);not null; comment:'内存模块'" json:"module"`
	HostsIp    string `gorm:"type:varchar(20);not null; comment:'目标地址'" json:"hosts_ip"`
	StartTime  string `comment:'执行时间'" json:"start_time"`
	ExpendTime string `comment:'消耗时间'" json:"expend_time"`
	ShellExec  string `gorm:"not null; comment:'执行命令'" json:"shell_exec"`
	Status     uint   `gorm:"comment:'状态,0表示成功，1表示失败';default:0" json:"status"`
}

type TaskReq struct {
	TaskName  string `json:"task_name" form:"task_name" binding:"required"`
	Module    string `json:"module" form:"module" binding:"required"`
	HostsIp   string `json:"hosts_ip" form:"hosts_ip" binding:"required"`
	ShellExec string `json:"shell_exec" form:"shell_exec" binding:"required"`
}

type TaskRes struct {
	Items []Task `json:"items"`
	Total int    `json:"total"`
}
